<?php
// Setup the class autoloader
function __autoload($class) {
	$class = str_replace("_", "/", $class);
	$class_name = Storage::get('docroot') . "/includes/" . $class . '.class.php';
	
	if(file_exists($class_name)) {
    	require $class_name;
	}else{
		die("Could not load class '$class' from $class_name");
	}
}

require("includes/Storage.class.php"); // Needs to be manually loaded
Storage::set('docroot', dirname(__FILE__));

// Load the config
require("config.php");

// Load up our header
Template::load("header");
Template::capture_start();

// Load up our start-up file
require("includes/startup.php");

// Load the router
require("router.php");

// Grab our contents et all
Template::capture_end();
Template::load("footer");
Template::output();

?>